package com.beerq;

import android.app.Application;
import android.widget.Toast;

import com.alibaba.fastjson.JSONObject;
import com.beerq.model.UserInfo;
import com.beerq.util.AppConfig;
import com.beerq.util.BeerQPref;
import com.beerq.util.Constants;
import com.beerq.util.StringUtil;

import com.tencent.bugly.Bugly;

import cn.jpush.android.api.JPushInterface;

/**
 * 作者：minj on 2017/8/22 10:25
 */
public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        //Bugly
        Bugly.init(getApplicationContext(), "0badf2caad", true);
        init();
    }


    private void init(){
        AppConfig.initParam(this);
        initUserInfo();


        JPushInterface.setDebugMode(true);
        JPushInterface.init(this);


    }

    private void initUserInfo(){
        String userInfo=BeerQPref.getInstance(this).getUserInfo();

        if(!StringUtil.isEmpty(userInfo)){
            Constants.userInfo=JSONObject.parseObject(userInfo,UserInfo.class);
        }

    }









}
